package org.jetlinks.protocol.official.mqtt.down;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jetlinks.core.message.function.FunctionInvokeMessage;
import org.jetlinks.protocol.official.TopicPayload;
import org.jetlinks.protocol.official.mqtt.down.radar60FL.Radar60FLDownHandler;
import org.jetlinks.protocol.official.mqtt.down.radar60SP.Radar60BreathSleepDownHandler;
import org.jetlinks.protocol.official.mqtt.down.zigbeeGateway.ZigbeeGatewayDownHandler;

import java.util.function.BiFunction;

/**
 * @Author bingzhong
 * @Date 2024/12/30 20:45
 * @Description 根据 functionIdPrefix 来匹配给哪个设备下发
 */
@Getter
@AllArgsConstructor
public enum DownTopicMessageEnum {

    Radar60_Breath_Sleep("/Radar60SP/%s/sys/property/set", "Radar60", Radar60BreathSleepDownHandler::encode),
    ZigbeeGateway("pvt/gateway/in", "ZigbeeGateway", ZigbeeGatewayDownHandler::encode),
    Radar60FL("/Radar60FL/%s/sys/property/set", "FallDown", Radar60FLDownHandler::encode);

    private final String topicPatten;

    private final String functionIdPrefix;

    private final BiFunction<FunctionInvokeMessage, String, TopicPayload> function;


}
